<%@ page contentType="text/html; charset=utf-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>        
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>新增填制要点</title>       
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/zcms/zDialog.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/zcms/zDrag.js"></script>
        <script type='text/javascript' src='${pageContext.request.contextPath}/dwr/engine.js'></script>
        <script type='text/javascript' src='${pageContext.request.contextPath}/dwr/util.js'></script>
        <script type="text/javascript">
            var fileInputNumber = 0;
            var fileName = "";
            function addFile()　　  	{	


                var strFile = "file"+fileInputNumber;
                var filePath = document.getElementById(strFile);


                document.getElementById(strFile).style.display = "none";
                var paths = filePath.value.split("\\");
                var name = paths[paths.length-1];
		
                fileName=fileName+"%"+name;
			
                document.getElementById("fileName").value=fileName;
	
                var str1 =
                    '<div style="background-color:#E7EBF7">'+
                    '<font size="2" style="width:300px">'+name+'</font>'+
                    '<a href="#"><img onclick="removeFile(this,'+strFile+')" src="../images/del2.gif" border="0" alt="删除附件"/></a>'+
                    '</div>';
                var _file = document.getElementById("_file");
			
                _file.insertAdjacentHTML("beforeend",str1);
                addInput();
            }
	
            function addInput(){
                fileInputNumber++;
                var strFile = "file"+fileInputNumber;
                var str2 = '<input name="file" id="'+strFile+'" type="file" value="添加附件" onchange="addFile()" />';
                var _input = document.getElementById("input");
                _input.insertAdjacentHTML("afterbegin",str2);
	
            }
        	
            function removeFile(id,strFile) {
                var new_tr = id.parentNode.parentNode;
                try {
                    //new_tr.removeNode(true);
                    // just ie , not w3c;
                    // other idea
                    var tmp = new_tr.parentNode;
                    // 为了在ie和firefox下都能正常使用,就要用另一个方法代替,最取上一层的父结点,然后remove.
                    tmp.removeChild(new_tr);		
                    removeInput(strFile);
                } catch(e) {}
            }
            function removeInput(strFile) {
                var _input = document.getElementById("input");
                try {
                    //new_tr.removeNode(true);
                    // just ie , not w3c;
                    // other idea
                    // 为了在ie和firefox下都能正常使用,就要用另一个方法代替,最取上一层的父结点,然后remove.
                    input.removeChild(strFile);
                } catch(e) {}
            }
            function sub(){
                return true;
            }
            function Chose(){
                var dellist=""
                var memberIds = document.getElementsByName('chose');
                var memberUsernames = document.getElementsByName('xxx');
                for (var i = 0;i<memberIds.length;i++) {
                    if (memberIds[i].checked) {
	    	
                        memberUsernames[i].style.display="";
                        dellist=memberIds[i].value+'%'+dellist;
	    	
                    }
                    else{
                        memberUsernames[i].style.display="none";
                    }
                }
	   
                document.getElementById('delstrings').value=dellist;
            }
            
            function del(acessoryId,documentId)
            {

                var msgs = "确认删除记录吗？";
                if (confirm(msgs) == true) {
                    window.location='del_acessory.action?document_id='+documentId+"&acessory_id="+acessoryId;
                    return true;
                } else {
                    return false;
                }
	
            }
  
            
            
            
            
            
        </script>
    </head>

    <body>

        <s:form id="form" name="form" action="%{actionURI}.action" method="post" theme="simple" ENCTYPE="multipart/form-data">  

            <s:hidden id="fileName" name="fileName"></s:hidden>
            <s:hidden id="delstrings" name="delstrings"></s:hidden>
            <s:if test="actionURI=='savePoints'">
                <input id="casePoints.caseId" name="casePoints.caseId" type="hidden" value="${caseId}"></input>
                <input id="caseId" name="caseId" type="hidden" value="${ca.id}"></input>

                <table width="65%" height="450" border="0"  align="center" cellpadding="2" cellspacing="1">   
                    <tr>
                        <td width="21%"  align="center" bgcolor="#b5d6e6">单证名称</td>
                        <td width="79%" align="center" bgcolor="#EBF4F5">
                            <input type="text" id="casePoints.name" name="casePoints.name" style="width: 90%; height: 90%" />
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#b5d6e6"  align="center">所属单证格式编号</td>
                        <td  align="center" bgcolor="#EBF4F5">
                            <input type="text" id="casePoints.documentCode" name="casePoints.documentCode" style="width: 90%; height: 90%" />
                        </td>                                     
                    </tr>
                    <tr>
                        <td bgcolor="#b5d6e6"  align="center">所属单证格式名称</td>
                        <td  align="center" bgcolor="#EBF4F5">
                            <input type="text" id="casePoints.documentName" name="casePoints.documentName" style="width: 90%; height: 90%" />
                        </td>                                     
                    </tr>                

                    <tr>
                        <td bgcolor="#b5d6e6"  align="center"><p >案例要点和解析</p></td>
                        <td  align="center" bgcolor="#EBF4F5">
                            <textarea id="casePoints.points" name="casePoints.points" rows="5" style="width: 90%"></textarea></td>
                    </tr>
                    <tr>
                        <td bgcolor="#b5d6e6"  align="center"><p >备注</p></td>
                        <td  align="center" bgcolor="#EBF4F5">
                            <textarea id="casePoints.note" name="casePoints.note" rows="5" style="width: 90%"></textarea></td>
                    </tr> 

                    <tr>
                        <td rowspan="2" bgcolor="#deebf1" align="right" valign="middle">
                            <img src="../images/jiedian.gif" width="10" height="9"/>
                            &nbsp;上传附件：</td>
                        <td class="td-right-s" bgcolor="#EBF4F5" colspan="5"><table width="97%" border="1" cellspacing="0" cellpadding="0"  style="border:#C3BFB3 1px solid; border-collapse: collapse; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; background-color:#FFF" class="zcxx_tab3">
                                <tr>
                                    <td height="20" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="1" cellpadding="4">
                                            <tr>
                                                <td valign="top" height="100" colspan="2"><div id="_file"></div>
                                                    <br/></td>
                                            </tr>
                                            <tr>

                                                <td width="99%" bgcolor="#EBF4F5" style="padding-top: 1px; padding-bottom: 2px"  class="zc_add"><div id="input">
                                                        <input name="file" id="file0" type="file" value="添加附件" onChange="addFile()" />
                                                        <font class="zc_add">如果添加多个附件，请继续点击“浏览”</font> </div></td>
                                            </tr>
                                        </table></td>
                                </tr>
                            </table></td>
                    </tr>
                </table>          
            </s:if>
            <s:else>
                <s:hidden id="casePoints.id" name="casePoints.id"></s:hidden>
                <s:hidden id="casePoints.num" name="casePoints.num"></s:hidden>
                <s:hidden id="casePoints.caseId" name="casePoints.caseId"></s:hidden>
                <table width="65%" height="450" border="0"  align="center" cellpadding="2" cellspacing="1">   
                    <tr>
                        <td width="21%"  align="center" bgcolor="#b5d6e6">单证名称</td>
                        <td width="79%" align="center" bgcolor="#EBF4F5">
                            <input type="text" id="casePoints.name" name="casePoints.name" value="<s:property value="casePoints.name"/>" style="width: 90%; height: 90%" />
                        </td>
                    </tr>
                    <tr>
                        <td bgcolor="#b5d6e6"  align="center">所属单证格式编号</td>
                        <td  align="center" bgcolor="#EBF4F5">
                            <input type="text" id="casePoints.documentCode" name="casePoints.documentCode" value="<s:property value="casePoints.documentCode"/>" style="width: 90%; height: 90%" />
                        </td>                                     
                    </tr>
                    <tr>
                        <td bgcolor="#b5d6e6"  align="center">所属单证格式名称</td>
                        <td  align="center" bgcolor="#EBF4F5">
                            <input type="text" id="casePoints.documentName" name="casePoints.documentName" value="<s:property value="casePoints.documentName"/>" style="width: 90%; height: 90%" />
                        </td>                                     
                    </tr>                

                    <tr>
                        <td bgcolor="#b5d6e6"  align="center"><p >案例要点和解析</p></td>
                        <td  align="center" bgcolor="#EBF4F5">
                            <!--                                  <s:textfield id="casePoints.points" name="casePoints.points" cssStyle="width: 60%" rows="6"/>	-->
                            <textarea id="casePoints.points" name="casePoints.points" rows="6" style="width: 90%"><s:property value="casePoints.points"/></textarea></td>
                    </tr>
                    <tr>
                        <td bgcolor="#b5d6e6"  align="center"><p >备注</p></td>
                        <td  align="center" bgcolor="#EBF4F5">
                            <textarea id="casePoints.note" name="casePoints.note" rows="6" style="width: 90%"><s:property value="casePoints.note"/></textarea></td>
                    </tr> 
                    <tr>
                        <td width="13%" height="5%" align="right" valign="middle"
                            bgcolor="#deebf1">
                            附件：
                        </td>
                        <td class="td-right-s" bgcolor="#EBF4F5" colspan="5">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td colspan="2">
                                        <div id="input1" align="right">
                                            <s:iterator value="accessoryList" var="accesory">
                                                <tr>
                                                    <input name="chose" type="checkbox"
                                                           value="<s:property value='id'></s:property>"
                                                           style="border: 0px" onClick="{Chose(this.value)}">
                                                        <a
                                                            href="down.action?dlFileName=<s:property value='name'></s:property>">
                                                            <s:property value="truename" /> </a>

                                                        <img src="../images/del.gif"
                                                             <%-- onclick="javascript:return del(${id},${dc.id})" 单击删除附件  --%>
                                                             style="display: none"
                                                             name="xxx">
                                                            </tr>
                                                        </s:iterator>

                                                        </div>
                                                        </td>
                                                        </tr>
                                                        </table>

                                                        </td>
                                                        </tr>
                                                        <tr>
                                                            <td rowspan="2" bgcolor="#deebf1" align="right" valign="middle">
                                                                <img src="../images/jiedian.gif" width="10" height="9"/>
                                                                &nbsp;上传附件：</td>
                                                            <td class="td-right-s" bgcolor="#EBF4F5" colspan="5">
                                                                <table width="97%" border="1" cellspacing="0" cellpadding="0"  style="border:#C3BFB3 1px solid; border-collapse: collapse; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; background-color:#FFF" class="zcxx_tab3">
                                                                    <tr>
                                                                        <td height="20" bgcolor="#FFFFFF">
                                                                            <table width="100%" border="0" cellspacing="1" cellpadding="4">
                                                                                <tr>
                                                                                    <td valign="top" height="100" colspan="2">
                                                                                        <div id="_file"></div>
                                                                                        <br/>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td width="99%" bgcolor="#EBF4F5" style="padding-top: 1px; padding-bottom: 2px"  class="zc_add">
                                                                                        <div id="input">
                                                                                            <input name="file" id="file0" type="file" value="添加附件" onChange="addFile()" />
                                                                                            <font class="zc_add">如果添加多个附件，请继续点击“浏览”</font> </div>
                                                                                    </td>
                                                                                </tr>
                                                                            </table></td>
                                                                    </tr>
                                                                </table></td>
                                                        </tr>
                                                        </table>          
                                                    </s:else>
                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0"
                                                           height="8%">
                                                        <tr align="center" bgcolor="white">
                                                            <td align="center" height="12" style="padding-top: 5px">
                                                                <input class="mmBtn"  type="submit" value="保存"/>
                                                                &nbsp;
                                                                <input name="button" type="button" class="mmBtn"
                                                                       onClick="window.location='pointslist.action?caseId=${ca.id}'" value="返回"/>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </s:form>
                                                </body>
                                                </html>